<?
header("Content-Type: text/html; charset=UTF-8");
include("udnutil.php");
include('lang.php');

$google = strpos($_SERVER['HTTP_REFERER'],'google') !== FALSE;
$crawler = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'google') !== FALSE;
$fullurl = "http://127.0.0.1".$_SERVER['REQUEST_URI'];


$segs = explode('/', $fullurl);
$baseUrl = str_replace($segs[count($segs) - 1], "", $fullurl);

//remove any copyrighted material
$copyright = array("tt1931466","nm0304643","tt0235970", "tt2849614", "tt1353033", "tt0341630", "tt0341630", "tt0341630",
 "tt0341630", "tt0336533", "tt0341630 ", "tt0341630", "tt0102748", "tt0336533", "tt0102748", "tt0102748", "tt2119383", "tt2195922");
foreach($copyright as $cp)
    if(strpos($fullurl, $cp) !== FALSE)
    {
        echo "The requested content has been removed permanently due to reported copyright infringement.";
        exit();
    }

if($_GET['movieid'] != null && $_GET['movieid'] != "")
{
    $contents = udnutil::db_check($_GET['movieid'], null, 60);
    $contents['keywords'] = lang::get('seo_keywords_movie');
    $contents['seo_desc'] = lang::get('seo_description_movie');
    //print_r($contents);exit();
    $template = 'template_movie.php';
    include('template_main.php');
}
else if($_GET['personid'] != null && $_GET['personid'] != "")
{
    $contents = udnutil::db_check($_GET['personid'], null, 60);
    $contents['keywords'] = lang::get('seo_keywords_person');
    $contents['seo_desc'] = lang::get('seo_description_person');
    //print_r($contents);exit();
    $template = 'template_person.php';
    include('template_main.php');
}
else if($_GET['udnsearch'] == '1')
{

    $contents = udnutil::db_check($_SERVER["QUERY_STRING"], lang::get_domain_lang(), 5);
    $contents['keywords'] = lang::get('seo_keywords_search');
    $contents['seo_desc'] = lang::get('seo_description_search');
    //$contents = search_parser::get_search();
    //print_r($contents);exit();
    $template = 'template_search.php';
    include('template_main.php');
}
else if($_GET['season'])
{
    include('season_parser.php');
    echo season_parser::get_season($_GET['id'], $_GET['title'], $_GET['season']);
}
else if($_GET['genre']) //backward compatibility
{
    if($_GET['genre'] == 'tv-series')
        $contents = udnutil::db_check("udnsearch=1&title_type=tv_series".$_GET['genre'], lang::get_domain_lang(), 3);
    else
        $contents = udnutil::db_check("udnsearch=1&genres=".$_GET['genre'], lang::get_domain_lang(), 3);

    $contents['keywords'] = lang::get('seo_keywords_search');
    $contents['seo_desc'] = lang::get('seo_description_search');
    //echo "udnsearch=1&genres=".$_GET['genre'];exit();
    $template = 'template_search.php';
    include('template_main.php');
}
elseif($_GET['download'])
{
    $contents = udnutil::db_check($_GET['id'], null, 60);
    $contents['keywords'] = lang::get('seo_keywords_download');
    $contents['seo_desc'] = lang::get('seo_description_download');
    $contents['google'] = $_GET['g'];
    $template = 'template_download.php';
    include('template_main.php');
}
elseif($_GET['translate'])
{
    echo lang::translate_jsonp($_GET['translate']);
}
elseif($_GET['cnt'])
{
    include('ifm.php');
}
elseif($_GET['email'])
{
    // include('email.php');
}
else
{
    $contents = udnutil::db_check("home".lang::get_domain_lang(), null, 1);
    $contents['keywords'] = lang::get('seo_keywords_home');
    $contents['seo_desc'] = lang::get('seo_description_home');
    $template = 'template_home.php';
    include('template_main.php');
}

?>

